<?php if ($this->userland->logged_in()
			&& ($this->Membership_model->is_owner($bricabox->id) || $this->userland->user_role() >= 4)
		): ?>

<form action="/bricabox/<?php echo $bricabox->id; ?>/save_vcard" method="post">
	<input type="hidden" name="content_id" value="<?php echo $content->id; ?>" />
	<input type="hidden" name="instance_id" value="<?php echo $inst->id; ?>" />
	<input type="hidden" name="save_id" value="<?php echo (int)$inst->id.$content->id; ?>" />
	<input type="hidden" name="return_to" value="/<?php echo $this->uri->uri_string(); ?>" />
	<fieldset>
		
		<div>
			<label for="vcard_name">Name:</label><br />
			<input type="text"
			id="vcard_name" name="vcard[name]" value="<?php echo hh($vcard->name); ?>" />
		</div>
		
<?php foreach(array('url'=>'URL', 'org'=>'Company', 'email'=>'Email', 'addr'=>'Address',
					'city'=>'City', 'state'=>'State', 'postal'=>'Postal code',
					'country'=>'Country', 'phone'=>'Phone') as $k => $v): ?>
		<div>
			<label for="vcard_<?php echo $k; ?>"><?php echo $v; ?>:</label><br />
			<input type="text"
			id="vcard_<?php echo $k; ?>" name="vcard[<?php echo $k; ?>]" value="<?php echo hh($vcard->$k); ?>" />
		</div>
<?php endforeach; ?>
		
		<div>
			<input type="submit" value="Save" />
		</div>
		
	</fieldset>
</form>

<?php else: ?>

	<div id="hcard-given-middle-family" class="vcard">
	 <?php if ($vcard->url): ?><a class="url fn n" href="<?php echo hh($vcard->url); ?>"><?php endif; ?>
		<?php if ($vcard->given): ?><span class="given-name"><?php echo hh($vcard->given); ?></span><?php endif; ?>
	  	<?php if ($vcard->middle): ?><span class="additional-name"><?php echo hh($vcard->middle); ?></span><?php endif; ?>
	  	<?php if ($vcard->family): ?><span class="family-name"><?php echo hh($vcard->family); ?></span><?php endif; ?>
	<?php if ($vcard->url): ?></a><?php endif; ?>
	 <?php if ($vcard->org): ?><div class="org"><?php echo hh($vcard->org); ?></div><?php endif; ?>
	 <?php if ($vcard->email): ?><a class="email" href="mailto:<?php echo $vcard->email; ?>"><?php echo hh($vcard->email); ?></a><?php endif; ?>
	 <div class="adr">
	  <?php if ($vcard->addr): ?><div class="street-address"><?php echo hh($vcard->addr); ?></div><?php endif; ?>
	  <?php if ($vcard->city): ?><span class="locality"><?php echo hh($vcard->city); ?></span>, <?php endif; ?>
	  <?php if ($vcard->state): ?><span class="region"><?php echo hh($vcard->state); ?></span>, <?php endif; ?>
	  <?php if ($vcard->postal): ?><span class="postal-code"><?php echo hh($vcard->postal); ?></span><?php endif; ?>
	  <?php if ($vcard->country): ?><span class="country-name"><?php echo hh($vcard->country); ?></span><?php endif; ?>
	 </div>
	 <?php if ($vcard->phone): ?><div class="tel"><?php echo hh($vcard->phone); ?></div><?php endif; ?>
	</div>

<?php endif; ?>

<p class="after-vcard">
	<a href="http://technorati.com/contacts/<?php echo bricabox_url($bricabox) . '/' . $this->uri->uri_string(); ?>"
	target="_blank">
		<img src="/assets/images/hcard.png" alt="Export vCard" />
	</a>
</p>

<style type="text/css" media="screen">
	<!--
	.vcard {line-height:18px;}
	.after-vcard {margin-top:7px;}
	-->
</style>